package com.personal.site.controller;

import com.personal.site.utils.CaptchaUtil;
import com.personal.site.utils.RandomUtil;
import com.personal.site.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/sys/login")
public class LoginController {

    @GetMapping("/getCaptchaCode")
    public Result<String> getCaptchaCodeImg(){
        String s = RandomUtil.randomString(6);
        log.info("验证码{}",s);
        String captcha = CaptchaUtil.createCaptcha(s);
        return Result.OK(captcha);
    }
}
